<div id="message">Als u een overzicht heeft ontvangen van uw schuldeiser, kunt u dit hieronder invullen</div>
<form method="post" action="{{self.request.path}}" class="client-debts-form">
    <div style="float:right">
{% if self.user.class_name == 'Client' %}
  <a href="/client/debts/creditor/{{creditor.key}}/response">
{%else %}
  <a href="/employee/cases/view/{{client.key}}/creditor/{{creditor.key.id}}/approve?base_url={{base_url}}" class="action approve">
{% endif %}
        {% if creditor.scan %}
        <img alt="Schuldbewijs" src="/client/debts/creditor/{{creditor.key}}/responseletter" width="115px" height="155px"></img>
        {% else %}
        Voeg een schuldbewijs toe.
        {% endif %}
        </a>
    </div>
    <p>
        Schuld bij: <strong>{{ creditor.creditor.display_name }}</strong><br>
        {% if creditor.creditor.is_collector %}
        <label>Oorspronkelijke schuldeiser:</label>
        <a href="/client/debts/creditor/select" target="_popup">{{collector.display_name|default:'Ja'}}<input type="hidden" name="collected_for" value="{{collected_for.key.id}}"></a>
        <br>
        {% endif %}
        <label>Deze schuld is uitbesteed aan een deurwaarder:</label>
        <a href="/client/debts/creditor/select" target="_popup">{{collector.display_name|default:'Ja'}}<input type="hidden" name="collector" value="{{collector.key.id}}"></a><br>
    </p>
        <table>
            <tr>
                <td><label>Datum brief</label></td>
                <td>{{form.response_date}}</td>
            </tr>
            <tr>
                <td><label>Dossiernummer</label></td>
                <td>{{form.creditor_dossier_number}}</td>
            </tr>
            <tr>
                <td><label>Openstaand bedrag</label></td>
                <td>{{form.amount}}</td>
                <td>{{form.amount.errors}}</td>
            </tr>
            <tr>
                <td><label>Afbetalingsregeling</label></td>
                <td>{{form.payment_amount}}</td>
            </tr>
        </table>
    <p class="submit">
        <input type="button" value="&lt;&lt; Terug" class="app-control" onclick="$.address.value($.address.value().replace('/view','/creditor'));">
        <input type="submit" value="Toevoegen &gt;&gt;">
    </p>

</form>
<div class="debts-listing">
    <table>
        <tr>
            <th>ID</th>
            <th>Deurwaarder</th>
            <th>Openstaand bedrag</th>
            <th>Datum brief</th>
            <th>Dossiernummer</th>
            <th>Afbetalingsregeling</th>
        </tr>
{% for debt in creditor.debts %}
        <tr>
            <td><a href="{{base_url}}/debt/{{debt.key.id}}">{{debt.key.id}}</td>
            <td>{{debt.collector.display_name|default:"--"}}</td>
            <td class="amount">&euro; {{debt.amount|default:""}}</td>
            <td class="date">{{debt.response_date|date:"d-m-Y"}}</td>
            <td class="dossier">{{debt.creditor_dossier_number|default:""}}</td>
            <td class="amount">&euro; {{debt.payment_amount|default:""}}</td>
        </tr>
{% endfor %}
    </table>
</div>

